package com.qingxin.park.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;

/**
 * 农作物分类表
 */
@Entity
@Table(name = "crops_type")
public class CropsType extends com.qingxin.sys.entity.BaseEntity implements
		java.io.Serializable {
	private static final long serialVersionUID = -7673831804108388480L;
	// Fields

	private String typeid;
	private String pid;
	private String typeCode;
	private String typeName;
	private String remark;
	private Set<Crops> cropses = new HashSet<>(0);

	// Constructors

	/** default constructor */
	public CropsType() {
	}
	
	

	public CropsType(String typeid) {
		this.typeid = typeid;
	}



	public CropsType(String typeid, String typeName) {
		this.typeid = typeid;
		this.typeName = typeName;
	}



	public CropsType(String typeid, String pid, String typeCode,
			String typeName, String remark) {
		this.typeid = typeid;
		this.pid = pid;
		this.typeCode = typeCode;
		this.typeName = typeName;
		this.remark = remark;
	}



	/** full constructor */
	public CropsType(String pid, String typeCode, String typeName,
			String remark, Set<Crops> cropses) {
		this.pid = pid;
		this.typeCode = typeCode;
		this.typeName = typeName;
		this.remark = remark;
		this.cropses = cropses;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "typeid", unique = true, nullable = false, length = 32)
	public String getTypeid() {
		return this.typeid;
	}

	public void setTypeid(String typeid) {
		this.typeid = typeid;
	}

	@Column(name = "pid", length = 32)
	public String getPid() {
		return this.pid;
	}

	public void setPid(String pid) {
		this.pid = pid;
	}

	@Column(name = "type_code", length = 20)
	public String getTypeCode() {
		return this.typeCode;
	}

	public void setTypeCode(String typeCode) {
		this.typeCode = typeCode;
	}

	@Column(name = "type_name", length = 50)
	public String getTypeName() {
		return this.typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cropsType")
	@JsonIgnore
	public Set<Crops> getCropses() {
		return this.cropses;
	}

	public void setCropses(Set<Crops> cropses) {
		this.cropses = cropses;
	}

}